package com.study.android.app.broadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

import com.today.step.lib.Logger;

import java.text.DateFormat;

public class TestReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (TextUtils.equals(TestBroadcastActivity.ACTION_TEST_ALARM, action)) {
            DateFormat dateFormat = DateFormat.getDateTimeInstance();
            Logger.i("TEST", "receive action. action=" + action
                    + ",time=" + dateFormat.format(System.currentTimeMillis()));
        }

        AlarmManagerUtils.setAlarm(context, TestBroadcastActivity.ACTION_TEST_ALARM);
    }
}
